<!DOCTYPE html>
<html>
<head>
  <title>Bootstrap-select test page</title>
  <meta charset="utf-8">
  <link rel="stylesheet" href="./bootstrap/Content/bootstrap.min.css">
  <link rel="stylesheet" href="dist/css/bootstrap-select.min.css">
  <style>
    body {

    }
  </style>
  <script src="dist/js/jquery.min.js"></script>
  <script src="./bootstrap/Scripts/bootstrap.min.js"></script>
  <script src="dist/js/bootstrap-select.js"></script>
    <style >
        #alert_div{
            width: 60%;
            position: fixed;
            top: 25%;
            left: 25%;
        }
    </style>
</head>
<body>
<div class="alert alert-danger alert-dismissible" role="alert" id="alert_div">
    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    <strong>警告 数据不合法  </strong> 任务名称不能为空！！
</div>
<!--
<div class="row">
    <div class="col-xs-6">
        <div class="form-group">
          <select id="testSelect" class="selectpicker" multiple data-live-search="true" data-live-search-placeholder="搜索" data-actions-box="true" data-width="75%">
            <optgroup label="filter1">
              <option value="a">option1</option>
              <option value="b">option2</option>
              <option value="c">option3</option>
              <option value="e">option4</option>
            </optgroup>
          </select>
        </div>
    </div>
</div>
<button id="seleectButton" value="测试">测试</button>-->
</body>
</html>
<script>
    $("#seleectButton").bind("click",function(){
        console.log($('#testSelect option:selected').text())//选中的文本
        var select=$('#testSelect option:selected') .val();
        console.log( select)//选中的值
        var arrList = new Array();
        $('#testSelect option:selected').each(function(index,obj){
            var valu = $(this).val();
            arrList.push(valu);
        })
        console.log("选中的值是"+arrList.toString());
        console.log($("#testSelect").get(0).selectedIndex)//索引
    })
</script>
